package personal.dao.accounting;

import java.util.List;

import personal.domain.accounting.Account;
import personal.domain.accounting.AccountType;
import personal.domain.accounting.MonthendAccountBalance;
import personal.domain.accounting.MonthwiseCalendar;


public interface AccountDAO {
	/**
	 * Returns all accounts in the database.
	 * @return List<Account>.
	 */
	public List<Account> getAllAccounts();
	/**
	 * Saves (insert or update) an account.
	 * @param account. Account to be saved.
	 * @return Account - Saved account with generated account id (for inserts).
	 */
	public Account saveAccount(Account account);
	/**
	 * Returns all account types in the database.
	 * @return List<AccountType>.
	 */
	public List<AccountType> getAllAccountTypes();
	/**
	 * Saves (insert or update) an account type.
	 * @param accountType. Account type to be saved.
	 * @return AccountType - Saved account type with generated account id (for inserts).
	 */
	public AccountType saveAccountType(AccountType accountType);
	/**
	 * Adds balance for an account for a month.
	 * @param accountBalance. Month end balance to be saved.
	 */
	public void saveMonthendAccountBalance(MonthendAccountBalance accountBalance);
	/**
	 * Adjusts month end balances for an account for all months since the provided month, for which
	 * the account has a month end balance in database.
	 * @param accountBalance. signed difference to be adjusted along with account id and starting calendar id. 
	 * @return. int - number of records adjusted
	 */
	public int adjustMonthendAccountBalanceSince(MonthendAccountBalance accountBalance);
	/**
	 * Finds month end balances across all accounts for a given year or month
	 * @param calendar. MonthwiseCalendar. Provide either year or both year and month to search
	 * @return List<MonthendAccountBalance>
	 */
	public List<MonthendAccountBalance> getCalendarMonthendAccountBalances(MonthwiseCalendar calendar);
}
